package com.synjones.handsetS8L;

import android.util.Log;

import java.io.File;
import java.io.FileWriter;

public class PowerUtil {
  private static final String TAG=PowerUtil.class.getName ();
  public static void power(String id) {
    Log.e (TAG, "power："+id);
    try {
      FileWriter localFileWriterOn = new FileWriter(new File("/proc/gpiocontrol/set_uhf"));
      localFileWriterOn.write(id);
      localFileWriterOn.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
    set_uart(id);
  }

  private static String set_uart="/proc/gpiocontrol/set_uart";
  public static void set_uart(String id) {
    try {
      FileWriter localFileWriterOn=new FileWriter (new File (set_uart));
      localFileWriterOn.write (id);
      localFileWriterOn.close ();
    } catch (Exception e) {
      e.printStackTrace ();
    }
  }


  public static void powerFinger(String id) {
    try {
      Log.e (TAG, "power....");
      FileWriter localFileWriterOn = new FileWriter(new File("/proc/gpiocontrol/set_id"));
      localFileWriterOn.write(id);
      localFileWriterOn.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }


  public static void powerUsb(String id) {
    try {
      Log.e (TAG, "powerUsb："+id);
      FileWriter localFileWriterOn = new FileWriter(new File("/proc/gpiocontrol/set_usb_switch"));// usb_switch
      localFileWriterOn.write(id);
      localFileWriterOn.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

}
